import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';
import 'package:kq_flutter_core_widget/config/kq_core_global.dart';
import 'package:kq_flutter_core_widget/resources/images.dart';
import 'package:kq_flutter_core_widget/utils/toast_util.dart';
import 'package:kq_flutter_tv_widgets/resources/kq_theme_colors.dart';
import 'package:kq_flutter_tv_widgets/theme/configs/form/kq_form_theme_config.dart';
import 'package:kq_flutter_tv_widgets/theme/configs/kq_theme_config.dart';
import 'package:kq_flutter_tv_widgets/theme/kq_theme_manager.dart';

class KqStyleUtil {
  /// 初始化主题
  static themeData() {
    /// 初始化Bruno主题
    BrnInitializer.register(
      allThemeConfig: BrnAllThemeConfig(
          appBarConfig: BrnAppBarConfig(titleMaxLength: 15),
          //主题色
          commonConfig: BrnCommonConfig(brandPrimary: KqThemeColors.bgBlue),
          //对话框主题配置
          dialogConfig: BrnDialogConfig(
              contentTextStyle:
                  BrnTextStyle(fontSize: 16.sp, color: KqThemeColors.text333),
              mainActionTextStyle: BrnTextStyle(
                  fontSize: 16.sp, color: KqThemeColors.textLightBlue),
              assistActionsTextStyle:
                  BrnTextStyle(fontSize: 16.sp, color: KqThemeColors.text999)),
          //表单全局样式修改
          formItemConfig: BrnFormItemConfig(
              formPadding: EdgeInsets.fromLTRB(0, 12.r, 16.r, 12.r),
              titlePaddingSm: EdgeInsets.only(left: 16.r - 10, right: 8.r),
              titlePaddingLg: EdgeInsets.only(left: 16.r, right: 8.r),
              subTitlePadding: EdgeInsets.only(left: 16.r, top: 6.r),
              errorPadding: EdgeInsets.only(left: 16.r),
              titleTextStyle: BrnTextStyle(fontSize: 14.r),
              hintTextStyle: BrnTextStyle(fontSize: 14.r),
              subTitleTextStyle: BrnTextStyle(fontSize: 12.r),
              contentTextStyle: BrnTextStyle(fontSize: 14.r),
              optionTextStyle: BrnTextStyle(fontSize: 14.r),
              disableTextStyle:
                  BrnTextStyle(fontSize: 14.r, color: KqThemeColors.text333),
              optionSelectedTextStyle:
                  BrnTextStyle(fontSize: 14.r, color: KqThemeColors.text333))),
    );

    /// 初始化KQ主题
    KqThemeManager.instance.register(KqThemeConfig(
        formConfig: KqFormThemeConfig(
            mustInputFontSize: 24.sp,
            titleFontSize: 24.sp,
            contentFontSize: 24.sp,
            paddingVertical: 24.r,
            paddingHorizontal: 24.r,
            unitFontSize: 24.sp,
            headerFontSize: 20.sp)));

    KqToastConfig()
      ..fontSize = 16.sp
      ..radius = 4.r
      ..bottomOffset = 134.r
      ..successIcon = Image.asset(
        Images.commonIcChengong,
        width: 20,
        height: 20,
        package: KqCoreGlobal.packageName,
      );
  }
}
